﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace FwProject.Migrations.FwProjectAppShopDb
{
    public partial class Add_Space_To_DataBase : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "ProductTypeSpce");

            migrationBuilder.AddColumn<string>(
                name: "ImagePic",
                table: "ShopProduct",
                maxLength: 200,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddColumn<bool>(
                name: "DefalutAddress",
                table: "shop_receiving_address",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<DateTime>(
                name: "CreationTime",
                table: "commodity_collection",
                nullable: false,
                defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));

            migrationBuilder.AddColumn<long>(
                name: "CreatorUserId",
                table: "commodity_collection",
                nullable: true);

            migrationBuilder.CreateTable(
                name: "Spce",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    SpceName = table.Column<string>(maxLength: 200, nullable: false),
                    SpceType = table.Column<int>(nullable: false),
                    SpceNote = table.Column<string>(nullable: true),
                    Orders = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Spce", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Spce");

            migrationBuilder.DropColumn(
                name: "ImagePic",
                table: "ShopProduct");

            migrationBuilder.DropColumn(
                name: "DefalutAddress",
                table: "shop_receiving_address");

            migrationBuilder.DropColumn(
                name: "CreationTime",
                table: "commodity_collection");

            migrationBuilder.DropColumn(
                name: "CreatorUserId",
                table: "commodity_collection");

            migrationBuilder.CreateTable(
                name: "ProductTypeSpce",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    DeleterUserId = table.Column<long>(nullable: true),
                    DeletionTime = table.Column<DateTime>(nullable: true),
                    IsDeleted = table.Column<bool>(nullable: false),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    Orders = table.Column<int>(nullable: false),
                    ProductTypeid = table.Column<Guid>(nullable: true),
                    SpceName = table.Column<string>(maxLength: 200, nullable: false),
                    SpceType = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductTypeSpce", x => x.Id);
                });
        }
    }
}
